/*=============================================================================
#    The element-comm is a tentative program used to test our ideas.           
#                       Copyright (C)  bgao                                    
#
#     This program is free software; you can redistribute it and/or            
#      modify it under the terms of the GNU General Public License             
#     as published by the Free Software Foundation; either version 2           
#         of the License, or (at your option) any later version.               
#
#     This program is distributed in the hope that it will be useful,          
#    but WITHOUT ANY WARRANTY; without even the implied warranty of           
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            
#             GNU General Public License for more details.                    
#
#    You should have received a copy of the GNU General Public License        
#     along with this program; if not, write to the Free Software             
#      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,             
#                       MA  02110-1301, USA.                                  
#==============================================================================
# $Id$ 
#
# $Author$ 
#
# $Revision$ 
#
# $Date$ 
#
# Description: 
#
=============================================================================*/
#include <string.h>
#include "rtos-wsn.h"

#ifdef  __ARMCC_VERSION
#include <armcc/stdarg.h>
#else
#include <stdarg.h>
#endif

extern int dbgputs (void * f, char * str, int count);

#define OUTPUT_TOGETHER


/* called by the user to output msg_id to the buffer. */
static void WSN_output(uint16 msg_id)
{
	dbgputs((void *)0, (char *)&msg_id, 2);

}

/* printf like output function */
void WSN_printf(uint16 msg_id, uint8 n_params, ...)
{
    va_list ap;
    int i;

   /* output format string msg_id */
   WSN_output(msg_id);

   va_start(ap, n_params);
   
   for (i = 0; i < n_params; i++) {
       WSN_output((uint16)va_arg(ap, int));
   }

   va_end(ap);
}

